<?php
//CORREGIDA
namespace Medicina\KernelBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Medicina\KernelBundle\Entity\PersonaAsesora
 *
 * @ORM\Table(name="personaAsesora")
 * @ORM\Entity
 */
class PersonaAsesora {

    /**
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @ORM\Column(name="tipo", type="string", length=30, nullable=false)
     */
    private $tipoAsesor;

    /**
     * @ORM\ManyToOne(targetEntity="Persona", inversedBy="asesoraConcursos" , cascade={"persist"})
     * @ORM\JoinColumn(name="persona_id", referencedColumnName="id")
     * 
     */
    private $persona;

    /**
     * @ORM\ManyToOne(targetEntity="Concurso", inversedBy="asesores")
     * @ORM\JoinColumn(name="concurso_id", referencedColumnName="id")
     */
    private $concurso;

    public static function getTiposAsesor(){
        return array('profesor' => 'Profesor', 'graduado' => 'Graduado', 'alumno' => 'Alumno');
    }

    
    public function getId()
    {
        return $this->id;
    }

 
    public function setTipoAsesor($tipoAsesor)
    {
        $this->tipoAsesor = $tipoAsesor;
    }


    public function getTipoAsesor()
    {
        return $this->tipoAsesor;
    }


    public function setPersona(\Medicina\KernelBundle\Entity\Persona $persona)
    {
        $this->persona = $persona;
    }

  
    public function getPersona()
    {
        return $this->persona;
    }

 
    public function setConcurso(\Medicina\KernelBundle\Entity\Concurso $concurso)
    {
        $this->concurso = $concurso;
    }


    public function getConcurso()
    {
        return $this->concurso;
    }
    
      public function __toString() {
        return $this->getPersona()->__toString();
    }
    
        public function getJsonForAjaxEdit() {
          return $output = array(
            'tipoAsesor' => $this->getTipoAsesor(),
            
        );
    }
}